<template>
  <div>
    <h2>Home页面</h2>
    <div class="box">
      <span>注册</span>
      <div class="content">
        <input type="text" class="input" @input="addUsername" placeholder="用户名/手机号" clearable />
        <input type="text" class="input" @input="addUsername" placeholder="真实姓名"  clearable/>
        <input type="text" class="input" @input="addUsername" placeholder="身份证号"  clearable/>
        <input type="password" class="input" @input="addUsername" placeholder="密码"  clearable/>
        <input type="password" class="input" @input="addUsername" placeholder="确认密码"  clearable/>
        <div class="Date">
          <input type="date" />
          <input type="time" />
        </div>
      </div>
      <div class="footer">
        <button @click="Register">注册</button>
        <button @click="Home">回到首页</button>
      </div>
    </div>
  </div>
</template>
  
<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const username = ref("");

const addUsername = (event) => {
  let name = event.target.value.trim();
  username.value = name;
};

const Register = () => {
  if (username.value == '') {
    alert("请完善信息");
  } else {
    alert("注册成功！！！");
    //跳转登录路由
    router.push({ path: "/" });
  }
};
const Home = () => {
  router.push({ path: "/" });
};
</script>
  
<style lang="scss" scoped>
.box {
  width: 300px;
  height: 350px;
  border: 1px solid skyblue;
  border-radius: 10px;
  margin-left: 50px;
  font-size: 25px;
  span {
    display: block;
    text-align: center;
  }
  .content {
    text-align: center;
    .Date{
      margin-top: 10px;
      display: flex;
      justify-content: space-around;
      align-items: center;
    }
    .input{
      width: 250px;
      height: 25px;
      margin: 3px 0;
    }
  }
  .footer {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
  }
}
</style>